﻿using System;

namespace ProjectIndieFarm
{
    public abstract class Challenge
    {
        public enum States
        {
            NotStart,
            Started,
            Finished,
        }

        public abstract string Name { get; }
        public int StartDate = 0;

        public States State = States.NotStart;

        protected Func<string> mDisplayNameFactory = () => string.Empty;

        /// <summary>
        /// 挑战初始化 注册事件监听
        /// </summary>
        public abstract void OnStart();
        /// <summary>
        /// 挑战目标的条件判断
        /// </summary>
        /// <returns>挑战是否达成</returns>
        public abstract bool CheckFinish();
        /// <summary>
        /// 完成挑战 注销事件监听 触发结算
        /// </summary>
        public abstract void OnFinish();

        public string GetDisplayName()
        {
            return mDisplayNameFactory();
        }
    }
}
